<template>
	<view class="">
		<navbar title="哔滴详情" bgColor="#fff" :back="true"></navbar>
		<view style="background-color: #fff;">
			<view class="u-flex u-row-around" style="padding:20rpx 0;">
				<view class="tab-item" @tap="tabChange(item)" :class="{'tab-item_sel':item.value==tabValue}"
					v-for="(item,index) in tab">
					{{item.label}}
				</view>
			</view>
		</view>
		<view style="background-color: #fff;margin-top: 20rpx;padding:20rpx 20rpx 0 20rpx;display: flex;justify-content: space-between;align-items: center;" v-if='infoList.length!=0'>
			<view v-for="(item,index) in infoList" :key="index" style="display: flex;align-items: center;justify-content:space-between;margin-bottom: 20rpx;width: 100%;">
			     <view style="display: flex;align-items: center;">
					  <image :src="item.avatar" mode="" style="width: 60rpx;height: 60rpx;border-radius:50%;margin-right: 20rpx;"></image>
					  <view style="color: #333;font-size: 26rpx;font-weight: 600;">{{item.nickname}} 哔滴了</view>
				  </view>
				  <view style="color: #999;font-size: 24rpx;">{{item.addTime}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import navbar from "@/components/baseNavbar.vue"
	import {
		getBdInfoSubList
	} from '@/api/shopAuth.js'
	export default{
		components:{
			navbar
		},
		data(){
			return{
				tabValue: 1,
				tab: [{
					label: "今天",
					value: 1
				}, {
					label: "近7天",
					value: 2
				}, {
					label: "近30天",
					value: 3
				}, {
					label: "本周",
					value: 4
				}, {
					label: "本月",
					value: 5
				}],
				infoList:[],
				params:{
					page:1,
					limit:20,
					dateType:1,
					productId:'',
					load:true
				}
			}
		},
		onLoad(option){
			if(option.id){
				this.params.productId = option.id
				this.resetList()
			}
		},
		methods:{
			tabChange(item) {
				this.tabValue = item.value
				this.params.dateType = item.value
				this.resetList()
			},
			resetList() {
				this.params.page = 1
				this.infoList = []
				this.getList()
			},
			getList() {
				if (!this.params.load) {
					return;
				}
				this.params.load = false;
				getBdInfoSubList(this.params).then(res => {
					console.log('111298102',res);
					this.params.page++
					this.infoList = this.infoList.concat(res.data.list)
					this.params.load = true
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.tab-item {
		font-size: 24rpx;
		color: #666666;
		background-color: #F5F5F5;
		line-height: 40rpx;
		padding: 0 20rpx;
		border-radius: 20rpx;
	}
	
	.tab-item_sel {
		background-color: #007DF7;
		color: #FFFFFF;
	}
</style>
<style>
	page{
		background-color: #f5f5f5;
	}
</style>